Skip to content

test: find vitest setup file by absolute path #4564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025

Conversation

iainlane
Copy link
Contributor

I've been struggling with running the tests in Neovim. I was getting

FAIL  functions/control-plane/src/github/client.test.ts [ functions/control-plane/src/github/client.test.ts ]
Error: Failed to load url <root>/../aws-vitest-setup.ts (resolved id: <root>/.../aws-vitest-setup.ts). Does the file exist?

(but with absolute paths)

Turns out this was because the tests couldn't be run using yarn vitest --config-file=lambdas/... path/to/test.test.ts.

When we resolve the paths using node:path.resolve() then this works.

I've been struggling with running the tests in Neovim. I was getting

```console
FAIL  functions/control-plane/src/github/client.test.ts [ functions/control-plane/src/github/client.test.ts ]
Error: Failed to load url <root>/../aws-vitest-setup.ts (resolved id: <root>/.../aws-vitest-setup.ts). Does the file exist?
```

(but with absolute paths)

Turns out this was because the tests couldn't be run using `yarn vitest
--config-file=lambdas/... path/to/test.test.ts`.

When we resolve the paths using `node:path.resolve()` then this works.
@iainlane
Copy link
Contributor Author

image

👍

@iainlane iainlane marked this pull request as ready for review April 25, 2025 09:12
@iainlane iainlane requested a review from a team as a code owner April 25, 2025 09:12
@npalm npalm merged commit 57fce77 into github-aws-runners:main Apr 25, 2025
5 checks passed
@npalm
Copy link
Member

npalm commented Apr 25, 2025

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants